import { TableOutlined } from "@ant-design/icons";
import { Divider, Table } from "antd";
import React from "react";
import SearchBar from "./SearchBar";

export default class TableBar extends React.Component {
  render() {
    const { includeSearch, searchConfig } = this.props;
    let searchBar;
    if (includeSearch) {
      searchBar = <SearchBar formConfig={searchConfig}></SearchBar>;
    }
    const dataSource = [
      {
        key: "1",
        name: "胡彦斌",
        age: 32,
        address: "西湖区湖底公园1号",
      },
      {
        key: "2",
        name: "胡彦祖",
        age: 42,
        address: "西湖区湖底公园1号",
      },
    ];

    const columns = [
      {
        title: "姓名",
        dataIndex: "name",
        key: "name",
      },
      {
        title: "年龄",
        dataIndex: "age",
        key: "age",
      },
      {
        title: "住址",
        dataIndex: "address",
        key: "address",
      },
    ];
    return (
      <div>
        {searchBar}
        <Divider orientation="left">
          <TableOutlined />
          &nbsp; 数据列表
        </Divider>
        <Table dataSource={dataSource} columns={columns}></Table>
      </div>
    );
  }
}
